Blockly.Blocks['Goertek_AtomicLEDOn'] = {
  init: function() {
    this.appendDummyInput()
        .appendField("点亮单个LED灯")
        .appendField(new Blockly.FieldDropdown([["LED1", "1"], ["LED2", "2"], ["LED3", "3"], ["LED4", "4"], ["LED5", "5"], ["LED6", "6"], ["LED7", "7"], ["LED8", "8"], ["LED9", "9"], ["LED10", "10"], ["LED11", "11"], ["LED12", "12"]]), "id")
        .appendField("颜色")
        .appendField(new Blockly.FieldColour("#ffffff"), "color");	
    this.setPreviousStatement(true, null);
    this.setNextStatement(true, null);
    this.setColour(250);
    this.setTooltip('');
    this.setHelpUrl('http://www.example.com/');
  }
};
Blockly.Python['Goertek_AtomicLEDOn'] = function(block) {
  //var text_plane = block.getFieldValue('plane');
  var text_id = block.getFieldValue('id');
  var text_color = block.getFieldValue('color');

  // TODO: Assemble Python into code variable.
  var code = 'TurnOnSingle(f1'+','+text_id+','+text_color+')\n';
  return code;
};

Blockly.Blocks['Goertek_AtomicLEDOff'] = {
  init: function() {
    this.appendDummyInput()
        .appendField("关闭单个LED灯")
	    .appendField(new Blockly.FieldDropdown([["LED1", "1"], ["LED2", "2"], ["LED3", "3"], ["LED4", "4"], ["LED5", "5"], ["LED6", "6"], ["LED7", "7"], ["LED8", "8"], ["LED9", "9"], ["LED10", "10"], ["LED11", "11"], ["LED12", "12"]]), "id");
    this.setPreviousStatement(true, null);
    this.setNextStatement(true, null);
    this.setColour(250);
    this.setTooltip('');
    this.setHelpUrl('http://www.example.com/');
  }
};
Blockly.Python['Goertek_AtomicLEDOff'] = function(block) {
  // TODO: Assemble Python into code variable.
 // var text_plane = block.getFieldValue('plane');
  var text_id = block.getFieldValue('id');
  var code = 'TurnOffSingle(f1'+','+text_id+')'+'\n';
  return code;
};
/* Blockly.Blocks['Goertek_MultiLEDOn'] = {
  init: function() {
    this.appendDummyInput()
        .appendField("打开多个LED灯")
		.appendField("flight")
		.appendField(new Blockly.FieldTextInput("f1"), "plane")
        .appendField(new Blockly.FieldCheckbox([["LED1", "1"], ["LED2", "2"], ["LED3", "3"], ["LED4", "4"], ["LED5", "5"], ["LED6", "6"], ["LED7", "7"], ["LED8", "8"], ["LED9", "9"], ["LED10", "10"], ["LED11", "11"], ["LED12", "12"]]), "id");
        	
    this.setPreviousStatement(true, null);
    this.setNextStatement(true, null);
    this.setColour(250);
    this.setTooltip('');
    this.setHelpUrl('http://www.example.com/');
  }
};
Blockly.Python['Goertek_MultiLEDOn'] = function(block) {
  var text_plane = block.getFieldValue('plane');
  var text_id = block.getFieldValue('id');

  // TODO: Assemble Python into code variable.
  var code = 'TurnOnMulti('+text_plane+','+text_id+','+text_R+','+text_RL+','+text_G+','+text_GL+','+text_B+','+text_BL+','+text_Mode+','+text_SubMode+')\n';
  return code;
};

Blockly.Blocks['Goertek_MultiLEDOff'] = {
  init: function() {
    this.appendDummyInput()
	    .appendField("关闭多个LED灯")
		.appendField("flight")
		.appendField(new Blockly.FieldTextInput("f1"), "plane")
		.appendField(new Blockly.FieldDropdown([["LED1", "1"], ["LED2", "2"], ["LED3", "3"], ["LED4", "4"], ["LED5", "5"], ["LED6", "6"], ["LED7", "7"], ["LED8", "8"], ["LED9", "9"], ["LED10", "10"], ["LED11", "11"], ["LED12", "12"]]), "id");
    this.setPreviousStatement(true, null);
    this.setNextStatement(true, null);
    this.setColour(250);
    this.setTooltip('');
    this.setHelpUrl('http://www.example.com/');
  }
};
Blockly.Python['Goertek_MultiLEDOff'] = function(block) {
  // TODO: Assemble Python into code variable.
  var text_plane = block.getFieldValue('plane');
  var text_id = block.getFieldValue('id');
  var code = 'TurnOffMulti('+text_plane+','+text_id+')'+'\n';
  return code;
}; */

Blockly.Blocks['Goertek_LEDSingleBlink'] = {
  init: function() {
    this.appendDummyInput()
	    .appendField("单个LED灯闪烁")
		.appendField(new Blockly.FieldDropdown([["LED1", "1"], ["LED2", "2"], ["LED3", "3"], ["LED4", "4"], ["LED5", "5"], ["LED6", "6"], ["LED7", "7"], ["LED8", "8"], ["LED9", "9"], ["LED10", "10"], ["LED11", "11"], ["LED12", "12"]]), "id")
        .appendField("颜色")
        .appendField(new Blockly.FieldColour("#ffffff"), "color");	
		this.setPreviousStatement(true, null);
    this.setNextStatement(true, null);
    this.setColour(250);
    this.setTooltip('');
    this.setHelpUrl('http://www.example.com/');
  }
};
Blockly.Python['Goertek_LEDSingleBlink'] = function(block) {
  // TODO: Assemble Python into code variable.
 // var text_plane = block.getFieldValue('plane');
  var text_id = block.getFieldValue('id');
  var text_color = block.getFieldValue('color');
  var text_light = block.getFieldValue('Light');
  var code = 'BlinkSingle(f1'+','+text_id+','+text_color+')'+'\n';
  return code;
};

Blockly.Blocks['Goertek_LEDTurnOnAll'] = {
  init: function() {
    var ftype=GetFlightDeviceType();
    this.appendDummyInput()
	    .appendField("LED全部点亮")
	this.appendDummyInput()
		.appendField("颜色1")
        .appendField(new Blockly.FieldColour("#ffffff"), "color1")	
		.appendField("颜色2")
        .appendField(new Blockly.FieldColour("#ffffff"), "color2")
		.appendField("颜色3")
        .appendField(new Blockly.FieldColour("#ffffff"), "color3")
		.appendField("颜色4")
        .appendField(new Blockly.FieldColour("#ffffff"), "color4")	
	this.appendDummyInput()
		.appendField("颜色5")
        .appendField(new Blockly.FieldColour("#ffffff"), "color5")	
		.appendField("颜色6")
        .appendField(new Blockly.FieldColour("#ffffff"), "color6")	
		.appendField("颜色7")
        .appendField(new Blockly.FieldColour("#ffffff"), "color7")	
		.appendField("颜色8")
        .appendField(new Blockly.FieldColour("#ffffff"), "color8")	
	this.appendDummyInput()
		.appendField("颜色9")
        .appendField(new Blockly.FieldColour("#ffffff"), "color9")
		.appendField("颜色10")
        .appendField(new Blockly.FieldColour("#ffffff"), "color10")	
		.appendField("颜色11")
        .appendField(new Blockly.FieldColour("#ffffff"), "color11")	
		.appendField("颜色12")
        .appendField(new Blockly.FieldColour("#ffffff"), "color12");	
    this.setPreviousStatement(true, null);
    this.setNextStatement(true, null);
    this.setColour(250);
    this.setTooltip('');
    this.setHelpUrl('http://www.example.com/');
  }
};
Blockly.Python['Goertek_LEDTurnOnAll'] = function(block) {
  // TODO: Assemble Python into code variable.
 // var text_plane = block.getFieldValue('plane');
  var text_color1 = block.getFieldValue('color1');
  var text_color2 = block.getFieldValue('color2');
  var text_color3 = block.getFieldValue('color3');
  var text_color4 = block.getFieldValue('color4');
  var text_color5 = block.getFieldValue('color5');
  var text_color6 = block.getFieldValue('color6');
  var text_color7 = block.getFieldValue('color7');
  var text_color8 = block.getFieldValue('color8');
  var text_color9 = block.getFieldValue('color9');
  var text_color10 = block.getFieldValue('color10');
  var text_color11 = block.getFieldValue('color11');
  var text_color12 = block.getFieldValue('color12');
  var code = 'TurnOnAll(f1,'+'['+text_color1+','+text_color2+','+text_color3+','+text_color4+','+text_color5+','+text_color6+','+text_color7+','+text_color8+','+text_color9+','+text_color10+','+text_color11+','+text_color12+']'+')'+'\n';
  return code;
 
};

Blockly.Blocks['Goertek_LEDTurnOnAll2'] = {
  init: function() {
    var ftype=GetFlightDeviceType();
    this.appendDummyInput()
	    .appendField("LED全部点亮")
	this.appendDummyInput()
		.appendField("颜色1")
        .appendField(new Blockly.FieldColour("#ffffff"), "color1")	
		.appendField("颜色2")
        .appendField(new Blockly.FieldColour("#ffffff"), "color2")
		.appendField("颜色3")
        .appendField(new Blockly.FieldColour("#ffffff"), "color3")
    this.appendDummyInput()
		.appendField("颜色4")
        .appendField(new Blockly.FieldColour("#ffffff"), "color4")	
		.appendField("颜色5")
        .appendField(new Blockly.FieldColour("#ffffff"), "color5");	
    this.setPreviousStatement(true, null);
    this.setNextStatement(true, null);
    this.setColour(250);
    this.setTooltip('');
    this.setHelpUrl('http://www.example.com/');
  }
};
Blockly.Python['Goertek_LEDTurnOnAll2'] = function(block) {
  // TODO: Assemble Python into code variable.
 // var text_plane = block.getFieldValue('plane');
  var text_color1 = block.getFieldValue('color1');
  var text_color2 = block.getFieldValue('color2');
  var text_color3 = block.getFieldValue('color3');
  var text_color4 = block.getFieldValue('color4');
  var text_color5 = block.getFieldValue('color5');
  var code = 'TurnOnAll(f1,'+'['+text_color1+','+text_color1+','+text_color1+','+text_color1+','+text_color1+','+text_color1+','+text_color1+','+text_color1+','+text_color2+','+text_color3+','+text_color4+','+text_color5+']'+')'+'\n';
  return code;
};

Blockly.Blocks['Goertek_LEDTurnOffAll'] = {
  init: function() {
    this.appendDummyInput()
	    .appendField("LED全部关闭");
    this.setPreviousStatement(true, null);
    this.setNextStatement(true, null);
    this.setColour(250);
    this.setTooltip('');
    this.setHelpUrl('http://www.example.com/');
  }
};
Blockly.Python['Goertek_LEDTurnOffAll'] = function(block) {
  // TODO: Assemble Python into code variable.
 // var text_plane = block.getFieldValue('plane');
  var code = 'TurnOffAll(f1)'+'\n';
  return code;
};



Blockly.Blocks['Goertek_LEDBlinkFastAll'] = {
  init: function() {
    this.appendDummyInput()
	    .appendField("LED全部快闪")
	this.appendDummyInput()
		.appendField("颜色1")
        .appendField(new Blockly.FieldColour("#ffffff"), "color1")	
		.appendField("颜色2")
        .appendField(new Blockly.FieldColour("#ffffff"), "color2")
		.appendField("颜色3")
        .appendField(new Blockly.FieldColour("#ffffff"), "color3")
		.appendField("颜色4")
        .appendField(new Blockly.FieldColour("#ffffff"), "color4")	
	this.appendDummyInput()
		.appendField("颜色5")
        .appendField(new Blockly.FieldColour("#ffffff"), "color5")	
		.appendField("颜色6")
        .appendField(new Blockly.FieldColour("#ffffff"), "color6")	
		.appendField("颜色7")
        .appendField(new Blockly.FieldColour("#ffffff"), "color7")	
		.appendField("颜色8")
        .appendField(new Blockly.FieldColour("#ffffff"), "color8")	
	this.appendDummyInput()
		.appendField("颜色9")
        .appendField(new Blockly.FieldColour("#ffffff"), "color9")
		.appendField("颜色10")
        .appendField(new Blockly.FieldColour("#ffffff"), "color10")	
		.appendField("颜色11")
        .appendField(new Blockly.FieldColour("#ffffff"), "color11")	
		.appendField("颜色12")
        .appendField(new Blockly.FieldColour("#ffffff"), "color12");	
    this.setPreviousStatement(true, null);
    this.setNextStatement(true, null);
    this.setColour(250);
    this.setTooltip('');
    this.setHelpUrl('http://www.example.com/');
  }
};
Blockly.Python['Goertek_LEDBlinkFastAll'] = function(block) {
  // TODO: Assemble Python into code variable.
  var text_plane = block.getFieldValue('plane');
  var text_color1 = block.getFieldValue('color1');
  var text_color2 = block.getFieldValue('color2');
  var text_color3 = block.getFieldValue('color3');
  var text_color4 = block.getFieldValue('color4');
  var text_color5 = block.getFieldValue('color5');
  var text_color6 = block.getFieldValue('color6');
  var text_color7 = block.getFieldValue('color7');
  var text_color8 = block.getFieldValue('color8');
  var text_color9 = block.getFieldValue('color9');
  var text_color10 = block.getFieldValue('color10');
  var text_color11 = block.getFieldValue('color11');
  var text_color12 = block.getFieldValue('color12');
  var code = 'BlinkFastAll(f1,'+'['+text_color1+','+text_color2+','+text_color3+','+text_color4+','+text_color5+','+text_color6+','+text_color7+','+text_color8+','+text_color9+','+text_color10+','+text_color11+','+text_color12+']'+')'+'\n';
 
  return code;
};

Blockly.Blocks['Goertek_LEDBlinkFastAll2'] = {
  init: function() {
    this.appendDummyInput()
	    .appendField("LED全部快闪")
	this.appendDummyInput()
		.appendField("颜色1")
        .appendField(new Blockly.FieldColour("#ffffff"), "color1")	
		.appendField("颜色2")
        .appendField(new Blockly.FieldColour("#ffffff"), "color2")
		.appendField("颜色3")
        .appendField(new Blockly.FieldColour("#ffffff"), "color3")
    this.appendDummyInput()
		.appendField("颜色4")
        .appendField(new Blockly.FieldColour("#ffffff"), "color4")	
		.appendField("颜色5")
        .appendField(new Blockly.FieldColour("#ffffff"), "color5");	
    this.setPreviousStatement(true, null);
    this.setNextStatement(true, null);
    this.setColour(250);
    this.setTooltip('');
    this.setHelpUrl('http://www.example.com/');
  }
};
Blockly.Python['Goertek_LEDBlinkFastAll2'] = function(block) {
  // TODO: Assemble Python into code variable.
  var text_plane = block.getFieldValue('plane');
  var text_color1 = block.getFieldValue('color1');
  var text_color2 = block.getFieldValue('color2');
  var text_color3 = block.getFieldValue('color3');
  var text_color4 = block.getFieldValue('color4');
  var text_color5 = block.getFieldValue('color5');
  var code = 'BlinkFastAll(f1,'+'['+text_color1+','+text_color1+','+text_color1+','+text_color1+','+text_color1+','+text_color1+','+text_color1+','+text_color1+','+text_color2+','+text_color3+','+text_color4+','+text_color5+']'+')'+'\n';
  return code;
};

Blockly.Blocks['Goertek_LEDBlinkSlowAll'] = {
  init: function() {
    this.appendDummyInput()
	    .appendField("LED全部慢闪")
	this.appendDummyInput()
		.appendField("颜色1")
        .appendField(new Blockly.FieldColour("#ffffff"), "color1")	
		.appendField("颜色2")
        .appendField(new Blockly.FieldColour("#ffffff"), "color2")
		.appendField("颜色3")
        .appendField(new Blockly.FieldColour("#ffffff"), "color3")
		.appendField("颜色4")
        .appendField(new Blockly.FieldColour("#ffffff"), "color4")	
	this.appendDummyInput()
		.appendField("颜色5")
        .appendField(new Blockly.FieldColour("#ffffff"), "color5")	
		.appendField("颜色6")
        .appendField(new Blockly.FieldColour("#ffffff"), "color6")	
		.appendField("颜色7")
        .appendField(new Blockly.FieldColour("#ffffff"), "color7")	
		.appendField("颜色8")
        .appendField(new Blockly.FieldColour("#ffffff"), "color8")	
	this.appendDummyInput()
		.appendField("颜色9")
        .appendField(new Blockly.FieldColour("#ffffff"), "color9")
		.appendField("颜色10")
        .appendField(new Blockly.FieldColour("#ffffff"), "color10")	
		.appendField("颜色11")
        .appendField(new Blockly.FieldColour("#ffffff"), "color11")	
		.appendField("颜色12")
        .appendField(new Blockly.FieldColour("#ffffff"), "color12");	
    this.setPreviousStatement(true, null);
    this.setNextStatement(true, null);
    this.setColour(250);
    this.setTooltip('');
    this.setHelpUrl('http://www.example.com/');
  }
};
Blockly.Python['Goertek_LEDBlinkSlowAll'] = function(block) {
  // TODO: Assemble Python into code variable.
 // var text_plane = block.getFieldValue('plane');
  var text_color1 = block.getFieldValue('color1');
  var text_color2 = block.getFieldValue('color2');
  var text_color3 = block.getFieldValue('color3');
  var text_color4 = block.getFieldValue('color4');
  var text_color5 = block.getFieldValue('color5');
  var text_color6 = block.getFieldValue('color6');
  var text_color7 = block.getFieldValue('color7');
  var text_color8 = block.getFieldValue('color8');
  var text_color9 = block.getFieldValue('color9');
  var text_color10 = block.getFieldValue('color10');
  var text_color11 = block.getFieldValue('color11');
  var text_color12 = block.getFieldValue('color12');
  var code = 'BlinkSlowAll(f1,'+'['+text_color1+','+text_color2+','+text_color3+','+text_color4+','+text_color5+','+text_color6+','+text_color7+','+text_color8+','+text_color9+','+text_color10+','+text_color11+','+text_color12+']'+')'+'\n';

  return code;
};
Blockly.Blocks['Goertek_LEDBlinkSlowAll2'] = {
  init: function() {
    this.appendDummyInput()
	    .appendField("LED全部慢闪")
	this.appendDummyInput()
		.appendField("颜色1")
        .appendField(new Blockly.FieldColour("#ffffff"), "color1")	
		.appendField("颜色2")
        .appendField(new Blockly.FieldColour("#ffffff"), "color2")
		.appendField("颜色3")
        .appendField(new Blockly.FieldColour("#ffffff"), "color3")
    this.appendDummyInput()
		.appendField("颜色4")
        .appendField(new Blockly.FieldColour("#ffffff"), "color4")	
		.appendField("颜色5")
        .appendField(new Blockly.FieldColour("#ffffff"), "color5");	
    this.setPreviousStatement(true, null);
    this.setNextStatement(true, null);
    this.setColour(250);
    this.setTooltip('');
    this.setHelpUrl('http://www.example.com/');
  }
};
Blockly.Python['Goertek_LEDBlinkSlowAll2'] = function(block) {
  // TODO: Assemble Python into code variable.
 // var text_plane = block.getFieldValue('plane');
  var text_color1 = block.getFieldValue('color1');
  var text_color2 = block.getFieldValue('color2');
  var text_color3 = block.getFieldValue('color3');
  var text_color4 = block.getFieldValue('color4');
  var text_color5 = block.getFieldValue('color5');
  var text_color6 = block.getFieldValue('color6');
  var text_color7 = block.getFieldValue('color7');
  var text_color8 = block.getFieldValue('color8');
  var text_color9 = block.getFieldValue('color9');
  var text_color10 = block.getFieldValue('color10');
  var text_color11 = block.getFieldValue('color11');
  var text_color12 = block.getFieldValue('color12');
  var code = 'BlinkSlowAll(f1,'+'['+text_color1+','+text_color1+','+text_color1+','+text_color1+','+text_color1+','+text_color1+','+text_color1+','+text_color1+','+text_color2+','+text_color3+','+text_color4+','+text_color5+']'+')'+'\n';
  return code;
};

Blockly.Blocks['Goertek_LEDBreath'] = {
  init: function() {
    this.appendDummyInput()
        .appendField("LED呼吸灯 ")
        .appendField("颜色")
        .appendField(new Blockly.FieldColour("#ffffff"), "color");	
    this.setPreviousStatement(true, null);
    this.setNextStatement(true, null);
    this.setColour(250);
    this.setTooltip('');
    this.setHelpUrl('http://www.example.com/');
  }
};
Blockly.Python['Goertek_LEDBreath'] = function(block) {
  //var text_plane = block.getFieldValue('plane');
  var text_id = block.getFieldValue('id');
  var text_color = block.getFieldValue('color');
  // TODO: Assemble Python into code variable.
  var code = 'Breath(f1,'+'[1,2,3,4,5,6,7,8,9,10,11,12]'+','+'['+text_color+','+text_color+','+text_color+','+text_color+','+text_color+','+
      text_color+','+text_color+','+text_color+','+text_color+','+text_color+','+text_color+','+text_color+']'+')\n'; 
   
      
  return code;
};

Blockly.Blocks['Goertek_LEDHorseRacel'] = {
  init: function() {
    this.appendDummyInput()
	    .appendField("LED多彩跑马灯")
	this.appendDummyInput()
		.appendField("颜色1")
        .appendField(new Blockly.FieldColour("#ffffff"), "color1")	
		.appendField("颜色2")
        .appendField(new Blockly.FieldColour("#ffffff"), "color2")
		.appendField("颜色3")
        .appendField(new Blockly.FieldColour("#ffffff"), "color3")
		.appendField("颜色4")
        .appendField(new Blockly.FieldColour("#ffffff"), "color4")	
	this.appendDummyInput()
		.appendField("颜色5")
        .appendField(new Blockly.FieldColour("#ffffff"), "color5")	
		.appendField("颜色6")
        .appendField(new Blockly.FieldColour("#ffffff"), "color6")	
		.appendField("颜色7")
        .appendField(new Blockly.FieldColour("#ffffff"), "color7")	
		.appendField("颜色8")
        .appendField(new Blockly.FieldColour("#ffffff"), "color8")	
	 this.appendDummyInput()
		.appendField("颜色9")
        .appendField(new Blockly.FieldColour("#ffffff"), "color9")
		.appendField("颜色10")
        .appendField(new Blockly.FieldColour("#ffffff"), "color10")	
		.appendField("颜色11")
        .appendField(new Blockly.FieldColour("#ffffff"), "color11")	
		.appendField("颜色12")
        .appendField(new Blockly.FieldColour("#ffffff"), "color12");	
    this.setPreviousStatement(true, null);
    this.setNextStatement(true, null);
    this.setColour(250);
    this.setTooltip('');
    this.setHelpUrl('http://www.example.com/');
  }
};
Blockly.Python['Goertek_LEDHorseRacel'] = function(block) {
  // TODO: Assemble Python into code variable.
 // var text_plane = block.getFieldValue('plane');
  var text_color1 = block.getFieldValue('color1');
  var text_color2 = block.getFieldValue('color2');
  var text_color3 = block.getFieldValue('color3');
  var text_color4 = block.getFieldValue('color4');
  var text_color5 = block.getFieldValue('color5');
  var text_color6 = block.getFieldValue('color6');
  var text_color7 = block.getFieldValue('color7');
  var text_color8 = block.getFieldValue('color8');
  var text_color9 = block.getFieldValue('color9');
  var text_color10 = block.getFieldValue('color10');
  var text_color11 = block.getFieldValue('color11');
  var text_color12 = block.getFieldValue('color12');
  var code = 'HorseRace(f1,'+'['+text_color1+','+text_color2+','+text_color3+','+text_color4+','+text_color5+','+text_color6+','+text_color7+','+text_color8+','+text_color9+','+text_color10+','+text_color11+','+text_color12+']'+')'+'\n';
  return code;
};
Blockly.Python['Goertek_LEDSingleBlink'] = function(block) {
  // TODO: Assemble Python into code variable.
 // var text_plane = block.getFieldValue('plane');
  var text_id = block.getFieldValue('id');
  var text_color = block.getFieldValue('color');
  var text_light = block.getFieldValue('Light');
  var code = 'BlinkSingle(f1'+','+text_id+','+text_color+')'+'\n';
  return code;
};

Blockly.Blocks['Goertek_LEDTurnOnAllSingleColor'] = {
  init: function() {
    this.appendDummyInput()
	    .appendField("LED全部点亮")
        .appendField("颜色")
        .appendField(new Blockly.FieldColour("#ffffff"), "color1");	
    this.setPreviousStatement(true, null);
    this.setNextStatement(true, null);
    this.setColour(250);
    this.setTooltip('');
    this.setHelpUrl('http://www.example.com/');
  }
};
Blockly.Python['Goertek_LEDTurnOnAllSingleColor'] = function(block) {
  // TODO: Assemble Python into code variable.
 // var text_plane = block.getFieldValue('plane');
  var text_color1 = block.getFieldValue('color1');
  var code = 'TurnOnAll(f1,'+'['+text_color1+','+text_color1+','+text_color1+','+text_color1+','+text_color1+','+text_color1+','+text_color1+','+text_color1+','+text_color1+','+text_color1+','+text_color1+','+text_color1+']'+')'+'\n';
 
  return code;
};
Blockly.Blocks['Goertek_LEDTurnOnAllSingleColor2'] = {
  init: function() {
    this.appendDummyInput()
	    .appendField("飞机灯光变为")
        .appendField(new Blockly.FieldColour("#ffffff"), "color1");	
    this.setPreviousStatement(true, null);
    this.setNextStatement(true, null);
    this.setColour(250);
    this.setTooltip('');
    this.setHelpUrl('http://www.example.com/');
  }
};
Blockly.Python['Goertek_LEDTurnOnAllSingleColor2'] = function(block) {
  // TODO: Assemble Python into code variable.
 // var text_plane = block.getFieldValue('plane');
  var text_color1 = block.getFieldValue('color1');
  var code = 'AllOn(f1,'+text_color1+',1)'+'\n';
 
  return code;
};
Blockly.Blocks['Goertek_LEDTurnOffAll2'] = {
  init: function() {
    this.appendDummyInput()
	    .appendField("关闭飞机灯光");
    this.setPreviousStatement(true, null);
    this.setNextStatement(true, null);
    this.setColour(250);
    this.setTooltip('');
    this.setHelpUrl('http://www.example.com/');
  }
};
Blockly.Python['Goertek_LEDTurnOffAll2'] = function(block) {
  // TODO: Assemble Python into code variable.
 // var text_plane = block.getFieldValue('plane');
  var code = 'AllOff(f1)'+'\n';
  return code;
};

Blockly.Blocks['Goertek_LEDBlinkALL2'] = {
  init: function() {
    this.appendDummyInput()
	    .appendField("飞机灯光先变为")
        .appendField(new Blockly.FieldColour("#ffffff"), "color1")
        .appendField(",亮度为")
        .appendField(new Blockly.FieldDropdown([
            ["100%", "1"],
            ["80%", "0.8"],
            ["60%", "0.6"],
            ["40%", "0.4"],
            ["20%", "0.2"] 
            ]), "bright")
        .appendField(",持续")
        .appendField(new Blockly.FieldNumber(100, 100, 65535), "dur")
        .appendField("ms,再关闭")
        .appendField(new Blockly.FieldNumber(100, 100,  65535), "delay")
        .appendField("ms");	
    this.setPreviousStatement(true, null);
    this.setNextStatement(true, null);
    this.setColour(250);
    this.setTooltip('');
    this.setHelpUrl('http://www.example.com/');
  }
};
Blockly.Python['Goertek_LEDBlinkALL2'] = function(block) {
  // TODO: Assemble Python into code variable.
 // var text_plane = block.getFieldValue('plane');
  var text_color1 = block.getFieldValue('color1');
  var brightness = block.getFieldValue('bright');
  var duration = block.getFieldValue('dur');
  var delay = block.getFieldValue('delay');
  var code = 'AllBlink(f1,'+text_color1+','+duration+','+delay+','+brightness+')'+'\n';
 
  return code;
};
Blockly.Blocks['Goertek_LEDBreathALL2'] = {
  init: function() {
    this.appendDummyInput()
        .appendField("飞机灯光在")
        .appendField(new Blockly.FieldNumber(100, 100, 65535), "dur")
	    .appendField("ms逐渐变为")
        .appendField(new Blockly.FieldColour("#ffffff"), "color1")
        .appendField(",亮度为")
        .appendField(new Blockly.FieldDropdown([
            ["100%", "1"],
            ["80%", "0.8"],
            ["60%", "0.6"],
            ["40%", "0.4"],
            ["20%", "0.2"] 
            ]), "bright")
        .appendField(",然后在")
        .appendField(new Blockly.FieldNumber(100, 100,  65535), "delay")
        .appendField("ms逐渐变暗");	
    this.setPreviousStatement(true, null);
    this.setNextStatement(true, null);
    this.setColour(250);
    this.setTooltip('');
    this.setHelpUrl('http://www.example.com/');
  }
};
Blockly.Python['Goertek_LEDBreathALL2'] = function(block) {
  // TODO: Assemble Python into code variable.
 // var text_plane = block.getFieldValue('plane');
  var text_color1 = block.getFieldValue('color1');
  var brightness = block.getFieldValue('bright');
  var duration = block.getFieldValue('dur');
  var delay = block.getFieldValue('delay');
  var code = 'AllBreath(f1,'+text_color1+','+duration+','+delay+','+brightness+')'+'\n';
 
  return code;
};
Blockly.Blocks['Goertek_LEDTurnOnAllSingleColor3'] = {
  init: function() {
    this.appendDummyInput()
	    .appendField("机身灯光变为")
        .appendField(new Blockly.FieldColour("#ffffff"), "color1");	
    this.setPreviousStatement(true, null);
    this.setNextStatement(true, null);
    this.setColour(250);
    this.setTooltip('');
    this.setHelpUrl('http://www.example.com/');
  }
};
Blockly.Python['Goertek_LEDTurnOnAllSingleColor3'] = function(block) {
  // TODO: Assemble Python into code variable.
 // var text_plane = block.getFieldValue('plane');
  var text_color1 = block.getFieldValue('color1');
  var code = 'BodyOn(f1,'+text_color1+',1)'+'\n';
 
  return code;
};
Blockly.Blocks['Goertek_LEDTurnOffAll3'] = {
  init: function() {
    this.appendDummyInput()
	    .appendField("关闭机身灯光");
    this.setPreviousStatement(true, null);
    this.setNextStatement(true, null);
    this.setColour(250);
    this.setTooltip('');
    this.setHelpUrl('http://www.example.com/');
  }
};
Blockly.Python['Goertek_LEDTurnOffAll3'] = function(block) {
  // TODO: Assemble Python into code variable.
 // var text_plane = block.getFieldValue('plane');
  var code = 'BodyOff(f1)'+'\n';
  return code;
};

Blockly.Blocks['Goertek_LEDBlinkALL3'] = {
  init: function() {
    this.appendDummyInput()
	    .appendField("机身灯光先变为")
        .appendField(new Blockly.FieldColour("#ffffff"), "color1")
        .appendField("亮度为")
        .appendField(new Blockly.FieldDropdown([
            ["100%", "1"],
            ["80%", "0.8"],
            ["60%", "0.6"],
            ["40%", "0.4"],
            ["20%", "0.2"] 
            ]), "bright")
        .appendField(",持续")
        .appendField(new Blockly.FieldNumber(100, 100, 65535), "dur")
        .appendField("ms,再关闭")
        .appendField(new Blockly.FieldNumber(100, 100,  65535), "delay")
        .appendField("ms");	
    this.setPreviousStatement(true, null);
    this.setNextStatement(true, null);
    this.setColour(250);
    this.setTooltip('');
    this.setHelpUrl('http://www.example.com/');
  }
};
Blockly.Python['Goertek_LEDBlinkALL3'] = function(block) {
  // TODO: Assemble Python into code variable.
 // var text_plane = block.getFieldValue('plane');
  var text_color1 = block.getFieldValue('color1');
  var brightness = block.getFieldValue('bright');
  var duration = block.getFieldValue('dur');
  var delay = block.getFieldValue('delay');
  var code = 'BodyBlink(f1,'+text_color1+','+duration+','+delay+','+brightness+')'+'\n';
 
  return code;
};
Blockly.Blocks['Goertek_LEDBreathALL3'] = {
  init: function() {
    this.appendDummyInput()
        .appendField("机身灯光在")
        .appendField(new Blockly.FieldNumber(100, 100, 65535), "dur")
	    .appendField("ms逐渐变为")
        .appendField(new Blockly.FieldColour("#ffffff"), "color1")
        .appendField(",亮度为")
        .appendField(new Blockly.FieldDropdown([
            ["100%", "1"],
            ["80%", "0.8"],
            ["60%", "0.6"],
            ["40%", "0.4"],
            ["20%", "0.2"] 
            ]), "bright")
        .appendField(",然后在")
        .appendField(new Blockly.FieldNumber(100, 100,  65535), "delay")
        .appendField("ms逐渐变暗");	
    this.setPreviousStatement(true, null);
    this.setNextStatement(true, null);
    this.setColour(250);
    this.setTooltip('');
    this.setHelpUrl('http://www.example.com/');
  }
};
Blockly.Python['Goertek_LEDBreathALL3'] = function(block) {
  // TODO: Assemble Python into code variable.
 // var text_plane = block.getFieldValue('plane');
  var text_color1 = block.getFieldValue('color1');
  var brightness = block.getFieldValue('bright');
  var duration = block.getFieldValue('dur');
  var delay = block.getFieldValue('delay');
  var code = 'BodyBreath(f1,'+text_color1+','+duration+','+delay+','+brightness+')'+'\n';
 
  return code;
};
Blockly.Blocks['Goertek_LEDTurnOnAllSingleColor4'] = {
  init: function() {
    this.appendDummyInput()
        .appendField("电机")
        .appendField(new Blockly.FieldDropdown([
                ["全部", "0"],
                ["1号", "1"],
                ["2号", "2"],
                ["3号", "3"],
                ["4号", "4"]
            ]), "motor")
	    .appendField("灯光变为")
        .appendField(new Blockly.FieldColour("#ffffff"), "color1");	
    this.setPreviousStatement(true, null);
    this.setNextStatement(true, null);
    this.setColour(250);
    this.setTooltip('');
    this.setHelpUrl('http://www.example.com/');
  }
};
Blockly.Python['Goertek_LEDTurnOnAllSingleColor4'] = function(block) {
  // TODO: Assemble Python into code variable.
  var motor = block.getFieldValue('motor');

  var text_color1 = block.getFieldValue('color1');
  var code = 'MotorOn(f1,'+motor+','+text_color1+',1)'+'\n';
 
  return code;
};
Blockly.Blocks['Goertek_LEDTurnOnAllColor4'] = {
  init: function() {
    this.appendDummyInput()
        .appendField("四个电机灯光变为")
        .appendField(new Blockly.FieldColour("#ffffff"), "color1")
        .appendField(new Blockly.FieldColour("#ffffff"), "color2")
        .appendField(new Blockly.FieldColour("#ffffff"), "color3")
        .appendField(new Blockly.FieldColour("#ffffff"), "color4");	
    this.setPreviousStatement(true, null);
    this.setNextStatement(true, null);
    this.setColour(250);
    this.setTooltip('');
    this.setHelpUrl('http://www.example.com/');
  }
};
Blockly.Python['Goertek_LEDTurnOnAllColor4'] = function(block) {
  // TODO: Assemble Python into code variable.
  var motor = block.getFieldValue('motor');
  var text_color1 = block.getFieldValue('color1');
  var text_color2 = block.getFieldValue('color2');
  var text_color3 = block.getFieldValue('color3');
  var text_color4 = block.getFieldValue('color4');
  var code = 'MotorOn(f1,['+text_color1+','+text_color2+','+text_color3+','+text_color4+'],1)'+'\n';
 
  return code;
};
Blockly.Blocks['Goertek_LEDTurnOffAll4'] = {
  init: function() {
    this.appendDummyInput()
        .appendField("关闭电机")
        .appendField(new Blockly.FieldDropdown([
                ["全部", "0"],
                ["1号", "1"],
                ["2号", "2"],
                ["3号", "3"],
                ["4号", "4"]
            ]), "motor")
	    .appendField("灯光");
    this.setPreviousStatement(true, null);
    this.setNextStatement(true, null);
    this.setColour(250);
    this.setTooltip('');
    this.setHelpUrl('http://www.example.com/');
  }
};
Blockly.Python['Goertek_LEDTurnOffAll4'] = function(block) {
  // TODO: Assemble Python into code variable.
  var motor = block.getFieldValue('motor');
   
  var code = 'MotorOff(f1,'+motor+')'+'\n';
  return code;
};

Blockly.Blocks['Goertek_LEDBlinkALL4'] = {
  init: function() {
    this.appendDummyInput()
        .appendField("电机")
        .appendField(new Blockly.FieldDropdown([
                ["全部", "0"],
                ["1号", "1"],
                ["2号", "2"],
                ["3号", "3"],
                ["4号", "4"]
            ]), "motor")
	    .appendField("灯光先变为")
        .appendField(new Blockly.FieldColour("#ffffff"), "color1")
        .appendField(",亮度为")
        .appendField(new Blockly.FieldDropdown([
            ["100%", "1"],
            ["80%", "0.8"],
            ["60%", "0.6"],
            ["40%", "0.4"],
            ["20%", "0.2"] 
            ]), "bright")
        .appendField(",持续")
        .appendField(new Blockly.FieldNumber(100, 100, 65535), "dur")
        .appendField("ms,再关闭")
        .appendField(new Blockly.FieldNumber(100, 100,  65535), "delay")
        .appendField("ms");	
    this.setPreviousStatement(true, null);
    this.setNextStatement(true, null);
    this.setColour(250);
    this.setTooltip('');
    this.setHelpUrl('http://www.example.com/');
  }
};
Blockly.Python['Goertek_LEDBlinkALL4'] = function(block) {
  // TODO: Assemble Python into code variable.
  var motor = block.getFieldValue('motor');
 
  var bright = block.getFieldValue('bright');
  var text_color1 = block.getFieldValue('color1');
  var duration = block.getFieldValue('dur');
  var delay = block.getFieldValue('delay');
  var code = 'MotorBlink(f1,'+motor+','+text_color1+','+duration+','+delay+','+bright+')'+'\n';
 
  return code;
};
Blockly.Blocks['Goertek_LEDBreathALL4'] = {
  init: function() {
    this.appendDummyInput()
        .appendField("电机")
        .appendField(new Blockly.FieldDropdown([
                ["全部", "0"],
                ["1号", "1"],
                ["2号", "2"],
                ["3号", "3"],
                ["4号", "4"]
            ]), "motor")
        .appendField("灯光在")
        .appendField(new Blockly.FieldNumber(100, 100, 65535), "dur")
	    .appendField("ms逐渐变为")
        .appendField(new Blockly.FieldColour("#ffffff"), "color1")
        .appendField(",亮度为")
        .appendField(new Blockly.FieldDropdown([
            ["100%", "1"],
            ["80%", "0.8"],
            ["60%", "0.6"],
            ["40%", "0.4"],
            ["20%", "0.2"] 
            ]), "bright")
        .appendField(",然后在")
        .appendField(new Blockly.FieldNumber(100, 100,  65535), "delay")
        .appendField("ms逐渐变暗");	
    this.setPreviousStatement(true, null);
    this.setNextStatement(true, null);
    this.setColour(250);
    this.setTooltip('');
    this.setHelpUrl('http://www.example.com/');
  }
};
Blockly.Python['Goertek_LEDBreathALL4'] = function(block) {
  // TODO: Assemble Python into code variable.
  var motor = block.getFieldValue('motor');
 
  var bright = block.getFieldValue('bright');
  var text_color1 = block.getFieldValue('color1');
  var duration = block.getFieldValue('dur');
  var delay = block.getFieldValue('delay');
  var code = 'MotorBreath(f1,'+motor+','+text_color1+','+duration+','+delay+','+bright+')'+'\n';
 
  return code;
};
Blockly.Blocks['Goertek_LEDHorseALL4'] = {
  init: function() {
    this.appendDummyInput()
        .appendField("四个电机灯光变为")
        .appendField(new Blockly.FieldColour("#ffffff"), "color1")
        .appendField(new Blockly.FieldColour("#ffffff"), "color2")
        .appendField(new Blockly.FieldColour("#ffffff"), "color3")
        .appendField(new Blockly.FieldColour("#ffffff"), "color4")
        .appendField(",然后灯光")
        .appendField(new Blockly.FieldDropdown([
                ["顺时针", "True"],
                ["逆时针", "False"]
            ]), "clock")
        .appendField("方向转圈,转一圈时间为")
        .appendField(new Blockly.FieldNumber(100, 100,  10000), "delay")
        .appendField("ms");	
    this.setPreviousStatement(true, null);
    this.setNextStatement(true, null);
    this.setColour(250);
    this.setTooltip('');
    this.setHelpUrl('http://www.example.com/');
  }
};
Blockly.Python['Goertek_LEDHorseALL4'] = function(block) {
  // TODO: Assemble Python into code variable.
 // var text_plane = block.getFieldValue('plane');
    var text_color1 = block.getFieldValue('color1');
    var text_color2 = block.getFieldValue('color2');
    var text_color3 = block.getFieldValue('color3');
    var text_color4 = block.getFieldValue('color4');
    var clockwise = block.getFieldValue('clock');
    var delay = block.getFieldValue('delay');
    var colors=[text_color1,text_color2,text_color3,text_color4];
     
  //var code = 'MotorHorse(f1,'+colors+','+clockwise+','+delay+')'+'\n';
    var code = 'MotorHorse(f1,'+'['+text_color1+','+text_color2+','+text_color3+','+text_color4+'],'+clockwise+','+delay+',1)'+'\n';
  return code;
};



